###################
### ENVIRONMENT ###
###################
import git
import importlib
import os
import sys
from colorama import Fore

from lib.utilities import load_configurations

### SET DEFAULT PATHS
ROOT = os.getcwd()

PATHS = {
    'root'        : ROOT,
    'lib'         : os.path.join(ROOT, 'lib'),
    'config_user' : os.path.join(ROOT, 'config_user.yaml')
}

### LOAD GSLAB MAKE
gs_path = os.path.join(PATHS['lib'], 'gslab_make', 'gslab_make', '__init__.py')
spec = importlib.util.spec_from_file_location('gslab_make', gs_path)
gs = importlib.util.module_from_spec(spec)
sys.modules['gslab_make'] = gs
spec.loader.exec_module(gs)

### LOAD CONFIG USER 
gs.update_executables(PATHS)
gs.check_conda_status(root = ROOT)

### CALL RUN OPTIONS IN CONFIG USER
config_user_dic = load_configurations.open_yaml("config_user.yaml")

###########
### RUN ###
###########

### RUN SCRIPTS
if config_user_dic["local"]["cluster_run"] == True:
    gs.run_module(root = ROOT, module = 'analysis_cluster')

gs.run_module(root = ROOT, module = 'analysis_local')
gs.run_module(root = ROOT, module = 'paper_slides')
